﻿using AutoMapper;
using Domain.Factory_Modeling;
using Domain.InvoiceTicket.Invoicing;
using Domain.InvoiceTicket.Ticket;
using Domain.Material_Management;
using Domain.Process_Procedures;
using Domain.Production_Modules;
using Domain.QualityInspection_Modelling;
using Domain.User;
using MES.Server.API.Application.Command.Account;
using MES.Server.API.Application.Command.Account.DocumentCodeRuleCommand;
using MES.Server.API.Application.Command.Factory_Modeling;
using MES.Server.API.Application.Command.InvoiceTicket.Invoice;
using MES.Server.API.Application.Command.InvoiceTicket.order;
using MES.Server.API.Application.Command.InvoiceTicket.Ticket;
using MES.Server.API.Application.Command.Material_Management;
using MES.Server.API.Application.Command.Process_Procedures.ProcessFlow;
using MES.Server.API.Application.Command.Process_Procedures.ProcessManagement;
using MES.Server.API.Application.Command.ProcessCategory;
using MES.Server.API.Application.Command.Production_Modules;
using MES.Server.API.Application.Command.Production_Modules.GroupInventory;
using MES.Server.API.Application.Command.Production_Modules.MaterialOutAsk;
using MES.Server.API.Application.Command.Production_Modules.PurchaseOrder;
using MES.Server.API.Application.Command.QualityInspection_ModCom;
using MES.Server.API.Application.Handler.InvoiceTicket.Invoice;
using MES.Server.API.Application.Handler.Production_Modules.PurchaseOrder;
using MES.Server.API.Dto.Factory_Modeling.OutPut;
using MES.Server.API.Dto.InvoiceTicketDTO;
using MES.Server.API.Dto.Material_Management.OutPut;
using MES.Server.API.Dto.ProcessProceduresDTO;
using MES.Server.API.Dto.Warehouse;
using MES.Server.API.Application.Command.InvoiceTicket.Invoice;
using MES.Server.API.Application.Handler.InvoiceTicket.Invoice;
using MES.Server.API.Application.Handler.ApprovalProcess;
using Domain.Examin;
using MES.Server.API.Dto.ApprovalProcess;

namespace MES.Server.API
{
    /// <summary>
    /// 指定Automapper映射关系
    /// </summary>
    public class AutomapperFiles : Profile
    {
        public AutomapperFiles()
        {
            #region 用户管理
            CreateMap<AccountAddCommand, AccountModel>();
            CreateMap<AccountUpdateCommand, AccountModel>();
             
            CreateMap<CreateDocumentCodeRuleCommand, DocumentCodeRule>().ReverseMap();
            #endregion
            #region 车间管理 
            //添加车间
            CreateMap<WorkShopModel,AddWorkShopCommand>().ReverseMap();
            //显示车间
            CreateMap<GetWorkShopOutPut, WorkShopModel>().ReverseMap();
            //修改车间
            CreateMap<WorkShopModel, UpdateWorkShopCommand>().ReverseMap();
            #endregion
            #region 产线管理 
            //添加产线
            CreateMap<ProductionLineModel, AddProductionLineCommand>().ReverseMap();
            //修改产线
            CreateMap<ProductionLineModel, UpdateProductionLineCommand>().ReverseMap();
            #endregion
            #region 物料群组 
            //添加物料群组
            CreateMap<MaterialGroupModel, AddMaterialGroupCommand>().ReverseMap();
            //修改物料群组
            CreateMap<MaterialGroupModel, UpdateMaterialGroupCommand>().ReverseMap();
            #endregion
            #region 产品物料
            //添加产品物料
            CreateMap<ProductMaterialsModel, AddProductMaterialsCommand>().ReverseMap();
            //修改产品物料
            CreateMap<ProductMaterialsModel, UpdateProductMaterialsCommand>().ReverseMap();
            #endregion
            #region BOM管理
            //添加BOM
            CreateMap<BomModel, AddBomCommand>().ReverseMap();
            //添加子级BOM
            CreateMap<BomModel, AddChildBomCommand>().ReverseMap();
            //更新BOM
            CreateMap<BomModel, UpdateBomCommand>().ReverseMap();
            //BOM输出映射
            CreateMap<BomModel, GetBomOutPut>().ReverseMap();
            #endregion
            #region 物料申请
            //添加物料申请
            CreateMap<MaterialAskModel, AddMaterialAskCommand>().ReverseMap();
            // 物料申请输出映射
            CreateMap<MaterialAskModel, GetMaterialAskOutPut>().ReverseMap();
            #endregion
            #region 工序分类
            //工序分类（新增、编辑）
            CreateMap<ProcessCategoryModel, AddProcessCategoryCommand>().ReverseMap();
            CreateMap<ProcessCategoryModel, UpdateProcessCategoryCommand>().ReverseMap();
            //工序管理（新增、编辑）
            CreateMap<CreateProcessManagementCommand, ProcessManagementModel>().ReverseMap();
            CreateMap<UpdateProcessManagementCommand, ProcessManagementModel>().ReverseMap();
            //工艺流程
            CreateMap<ProcedureDTO, ProcessManagementModel>().ReverseMap();
            CreateMap<AddProcessFlowCommand, ProcessFlowModel>().ReverseMap();
            #endregion
            #region 仓库
            CreateMap<WarehouseDeleteCommand, WarehouseModel>().ReverseMap();
            CreateMap<WarehouseCreateCommand, WarehouseModel>().ReverseMap();
            CreateMap<WarehouseUpdateCommand, WarehouseModel>().ReverseMap();
            CreateMap<InventoryCreateCommand, MaterialInventoryModel>().ReverseMap();
            //群组库存添加
            CreateMap<AddGroupInventoryCommand, GroupInventoryModel>().ReverseMap();
            CreateMap<InventoryUpdateCommand, MaterialInventoryModel>().ReverseMap();
            CreateMap<InventoryDeleteCommand, MaterialInventoryModel>().ReverseMap();
            //物料采购单添加
            CreateMap<AddPurchaseOrderCommand, PurchaseOrderModel>().ReverseMap();
            //供应商下拉
            CreateMap<GetVendorOutPut, VendorModel>().ReverseMap(); 
            //物料采购单添加
            CreateMap<AddMaterialOutAskCommand, MaterialOutAskModel>().ReverseMap(); 
            //物料采购单列表
            CreateMap<GetMaterialOutAskOutPut, MaterialOutAskModel>().ReverseMap();
            #endregion
            #region 生产订单
            CreateMap<ProduceDeleteCommand,ProduceModel>().ReverseMap();
            CreateMap<ProduceCreateCommand, ProduceModel>().ReverseMap();
            CreateMap<ProduceUpdateCommand, ProduceModel>().ReverseMap();
            #endregion

            #region 排程管理
            #endregion

            #region 质量检测

            CreateMap<QualityInspectionCreateCommands, QualityInspection>().ReverseMap();

            #endregion
            #region 到票出票
            CreateMap<TicketCreateCommand, TicketModel>().ReverseMap();
            CreateMap<InvoiceCreateCommand, InvoicingModel>().ReverseMap();
            CreateMap<Orderdto,OrderModel>().ReverseMap();

            CreateMap<OrderCreateCommand, OrderModel>().ReverseMap();
            



            //CreateMap<InvoiceDto, InvoicingModel>().ReverseMap();
            //CreateMap<InventoryCreateCommand, InvoicingModel>().ReverseMap();

            #endregion
            #region 审批
            CreateMap<ApprovalNodeModel, ConfigurationNodeDTO>().ReverseMap();
            #endregion
        }
    }
}